<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<!--<link href="/css/web/themes/about.css" rel="stylesheet">-->
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">

<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main">
    <section class="sec_1">
        <div class="div_1">
            <ul>
                <li><a href="/certificate/standardInfo">证书简介</a></li>
                <li class="this"><a href="/certificate/certificateInfo">标准信息</a></li>
                <li><a href="/certificate/gradeAnalyze">成绩分析</a></li>
            </ul>
        </div>
        <!-- 证书标准信息 -->
        <div class="div_2">
            <div>
                <span class="head_1 head_change" a="0">证书标准</span>
                <span class="head_1" a="1">考试流程介绍</span>
            </div>
            <!--<hr>-->
            <div id="zs">
                <div id="news"></div>
                <div id="page"></div>
                <div style="clear: both"></div>
            </div>
            <!-- 考试流程介绍 -->
            <div id="js">

            </div>
            <div style="clear: both;margin-bottom: 50px"></div>
        </div>

        <div style="clear: both"></div>
    </section>
</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
</body>
<script>

    $(".head_1").click(function () {
        if ($(this).attr("a")==0){
            $("#zs").css("display" , "block");
            $("#js").css("display" , "none");
        }else {
            $("#zs").css("display" , "none");
            $("#js").css("display" , "block");
        }

        $(this).addClass("head_change");
        $(this).siblings().removeClass("head_change");
        $(this).siblings().addClass("head_1");

        $.ajax({
            type:'post',
            url:'/certificate/examIntroduce',
            success:function (r) {
                var news =  '<p class="js_title">'+r.data.title+'</p>' +
                            '<div class="js_content">'+r.data.contents+'</div>';+
                            '<div ></div>'
                $("#js").html(news);
            }
        })
    })

    $(function () {
        $.ajax({
            url: "/certificate/selCertificateInfo",
            type: 'GET',
            data: {
                current: 1,
                number: 4
            },
            success: function (res) {
                console.log("res", res)
                if (res.data.pages == 0) {
                    $("#news").html('<div class="noData">暂无数据</div>');

                } else {
                    var list = res.data.records;
                    var news = '';
                    list.forEach(function (item, index) {
                        var a ='';
                        if(item.grade==0){
                            a='(高级)'
                        }else if(item.grade==1){
                            a='(中级)'
                        }else if(item.grade==2){
                            a='(初级)'
                        }
                        news += ' <div class="div_00">' +
                            '<div class="title">' + item.profileName + ''+a+'</div>' +
                            '<div class="span_1 b18"><span class="title_1">证书介绍：</span><p class="title_2">' + item.introduce + '</p></div>' +
                            '<div class="span_1 b18"><span class="title_1">相关专业：</span><p class="title_2">' + item.relatedMajors + '</p></div>' +
                            // '<div class="span_1 b18"><span class="title_1">考试总费用：</span><p class="title_2">' + item.examFee + '元</p></div>' +
                            '</div><hr>';
                    });
                    $("#news").html(news);
                    page(1, res.data.pages ,null);
                }
            }
        });
    });

    function page(num, tolPages , grade) {
        $("#page").paging({
            nowPage: Number(num), // 当前页码
            pageNum: Number(tolPages), // 总页码
            buttonNum: 10, //要展示的页码数量
            canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
            showOne: 0,//只有一页时，是否显示。0=不显示,1=显示（默认）
            callback: function (num) { //回调函数
                $.ajax({
                    url: "/certificate/selCertificateInfo",
                    type: 'GET',
                    data: {
                        current: num,
                        number:4
                    },
                    success: function (res) {
                       // console.log(res);
                        var list = res.data.records;
                        var news = '';
                        list.forEach(function (item, index) {
                            var a ='';
                            if(item.grade==0){
                                a='(高级)'
                            }else if(item.grade==1){
                                a='(中级)'
                            }else if(item.grade==2){
                                a='(初级)'
                            }
                            news += ' <div class="div_00">' +
                                '<div class="title">' + item.profileName + a + '</div>' +
                                '<div class="span_1 b18"><span class="title_1">证书介绍：</span><p class="title_2">' + item.introduce + '</p></div>' +
                                '<div class="span_1 b18"><span class="title_1">相关专业：</span><p class="title_2">' + item.relatedMajors + '</p></div>' +
                                // '<div class="span_1 b18"><span class="title_1">考试总费用：</span><p class="title_2">' + item.examFee + '元</p></div>' +
                                '</div><hr>';
                        });
                        $("#news").html(news)
                    }
                });
            }
        });
    }
</script>
<script type="text/javascript" src="/js/xlPaging.js"></script>
</html>